/* 
 * File:   accueil.h
 * Author: E084412C
 *
 * Created on 29 janvier 2013, 14:03
 */

#ifndef _ACCUEIL_H
#define	_ACCUEIL_H

#include <iostream>
#include "ui_accueil.h"
#include "string.h"
#include "modele/Date.h"
#include "modele/ListOfTask.h"
#include <QtXml>


using namespace std;

class accueil : public QMainWindow {
    Q_OBJECT
public:
    accueil();
    virtual ~accueil();
    
    void addList(string name, Date date, string selectTemplate);
    
    void editCurrentList(string newName);
    
    void addTemp(string name);
    
    void addTopTask(Task *newTask);
    
    void addChildTask(string parentName,  Task *newTask);
    
       
    ListOfTask* getSelectedList();
    
    list<ListOfTask*> getTemplates();
    
    
public slots :
    void addListListener();
    void removeList();
    
    
    void addTaskListener();
    
    void addTempListener();
    
    void supprTaskListener();
    
    void editTaskListener();
    
    void editListListener();
    
    void checkTaskListener();
        
    void updateViewTasksList();
        
    void writeDom();
    
    void clearDom();
    
    void restoreDom();
    
    void disableBtnTask();
    
    void enableBtnTask();
    //void readDom();
    
private:
    Ui::accueil widget;
    void split(vector<string>& vecteur, string chaine, char separateur);
    Task* recTaskFinder(list<Task*> top, string name);
    void recTaskView(QTreeWidgetItem *item, list<Task*> listOfunderTasks);
    QDomElement recTaskDom(QDomDocument dom, QDomElement item, list<Task*> listOfunderTasks);
    
    
};

#endif	/* _ACCUEIL_H */
